]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
background: Don't silently fizzle out when removing bad content from the cache
authorJasper St. Pierre <jstpierre@mecheye.net>
Tue, 3 Dec 2013 22:54:02 +0000 (17:54 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Wed, 4 Dec 2013 00:13:12 +0000 (19:13 -0500)
If the background is already removed, or we're trying to remove bad content,
this is probably a bug in content accounting, so let us crash so we can fix
the bugs.

https://bugzilla.gnome.org/show_bug.cgi?id=719803

js/ui/background.js

index 885e96ba64481d7a3f6a91449c17399c6596386d..a56a0af8bbd3e4fbc5c03ddcf459fb360ec599ab 100644 (file)
@@ -113,9 +113,9 @@ const BackgroundCache = new Lang.Class({
 
     _removeContent: function(contentList, content) {
         let index = contentList.indexOf(content);
-
-        if (index >= 0)
-            contentList.splice(index, 1);
+        if (index < 0)
+            throw new Error("Trying to remove invalid content: " + content);
+        contentList.splice(index, 1);
     },
 
     removePatternContent: function(content) {